#include "Size.h"

/// <summary>
/// Constructor
/// </summary>
/// <param name="sx"> The x-axis value </param>
/// <param name="sy"> The y-axis value </param>
/// <param name="sz"> The z-axis value </param>
CICore::Size::Size (const float sx, const float sy, const float sz) {
    x = sx;
    y = sy;
    z = sz;
}

/// <summary>
/// Destructor
/// </summary>
CICore::Size::~Size() {}







///<************************************************************************************************************>
///<********************************* region BASIC SIZE's UNARY OPERATIONS *************************************>
///<************************************************************************************************************>

/// <summary>
/// Postfix increment
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator ++ (Size& v, int) {
    v.x++;
    v.y++;
    v.z++;

    return v;
}

/// <summary>
/// Prefix increment
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator ++ (Size& v) {
    ++(v.x);
    ++(v.y);
    ++(v.z);

    return v;
}

/// <summary>
/// Postfix decrement
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator -- (Size& v, int) {
    v.x--;
    v.y--;
    v.z--;

    return v;
}

/// <summary>
/// Prefix decrement
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator -- (Size& v) {
    --(v.x);
    --(v.y);
    --(v.z);

    return v;
}
/***************************************************************************************************************
************************************ endregion BASIC SIZE's UNARY OPERATIONS ***********************************
****************************************************************************************************************/









///<************************************************************************************************************>
///<********************************* region BASIC SIZE's BINARY OPERATIONS ************************************>
///<************************************************************************************************************>

/// <summary>
/// Sum between two sizes
/// </summary>
/// <param name="a"> The first size </param>
/// <param name="b"> The second size </param>
/// <returns> The sum between the two sizes </returns>
CICore::Size CICore::operator + (const Size& a, const Size& b) {
    return Size(a.x+b.x, a.y+b.y, a.z+b.z);
}

/// <summary>
/// Assignment by addition between two sizes
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The size to be added </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator += (Size& a, const Size& b) {
    a.x += b.x;
    a.y += b.y;
    a.z += b.z;

    return a;
}

/// <summary>
/// Difference between two sizes
/// </summary>
/// <param name="a"> The first size </param>
/// <param name="b"> The second size </param>
/// <returns> The difference between the two sizes </returns>
CICore::Size CICore::operator - (const Size& a, const Size& b) {
    return Size(a.x-b.x, a.y-b.y, a.z-b.z);
}

/// <summary>
/// Assignment by substraction between two sizes
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The size to be substracted </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator -= (Size& a, const Size& b) {
    a.x -= b.x;
    a.y -= b.y;
    a.z -= b.z;

    return a;
}

/// <summary>
/// Product between two sizes
/// </summary>
/// <param name="a"> The multiplicand size </param>
/// <param name="b"> The multiplier size </param>
/// <returns> The product between the two sizes </returns>
CICore::Size CICore::operator * (const Size& a, const Size& b) {
    return Size(a.x*b.x, a.y*b.y, a.z*b.z);
}

/// <summary>
/// Assignment by multiplication between two sizes
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The multiplier size </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator *= (Size& a, const Size& b) {
    a.x *= b.x;
    a.y *= b.y;
    a.z *= b.z;

    return a;
}

/// <summary>
/// Quotient between two sizes
/// </summary>
/// <param name="a"> The dividend size </param>
/// <param name="b"> The divisor size </param>
/// <returns> The quotient between the two sizes </returns>
CICore::Size CICore::operator / (const Size& a, const Size& b) {
    return Size(a.x/b.x, a.y/b.y, a.z/b.z);
}

/// <summary>
/// Assignment by division between two sizes
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The divisor size </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator /= (Size& a, const Size& b) {
    a.x /= b.x;
    a.y /= b.y;
    a.z /= b.z;

    return a;
}


/// <summary>
/// Sum between a size and a float value
/// </summary>
/// <param name="a"> The size </param>
/// <param name="f"> The float value to be added </param>
/// <returns> The sum between the size and the float value </returns>
CICore::Size CICore::operator + (const Size& a, const float f) {
    return Size(a.x+f, a.y+f, a.z+f);
}

/// <summary>
/// Assignment by addition between a size and a float value
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The float value to be added </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator += (Size& a, const float f) {
    a.x += f;
    a.y += f;
    a.z += f;

    return a;
}

/// <summary>
/// Difference between a size and a float value
/// </summary>
/// <param name="a"> The size </param>
/// <param name="b"> The float value to be substracted </param>
/// <returns> The difference between the size and the float value </returns>
CICore::Size CICore::operator - (const Size& a, const float f) {
    return Size(a.x-f, a.y-f, a.z-f);
}

/// <summary>
/// Assignment by substraction between a size and a float value
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The float value to be substracted </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator -= (Size& a, const float f) {
    a.x -= f;
    a.y -= f;
    a.z -= f;

    return a;
}

/// <summary>
/// Product between a size and a float value
/// </summary>
/// <param name="a"> The multiplicand size </param>
/// <param name="b"> The multiplier float value </param>
/// <returns> The product between the and the float value </returns>
CICore::Size CICore::operator * (const Size& a, const float f) {
    return Size(a.x*f, a.y*f, a.z*f);
}

/// <summary>
/// Assignment by multiplication between a size and a float value
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The multiplier float value </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator *= (Size& a, const float f) {
    a.x *= f;
    a.y *= f;
    a.z *= f;

    return a;
}

/// <summary>
/// Quotient between a size and a float value
/// </summary>
/// <param name="a"> The dividend size </param>
/// <param name="b"> The divisor float value </param>
/// <returns> The quotient between the and the float value </returns>
CICore::Size CICore::operator / (const Size& a, const float f) {
    return Size(a.x/f, a.y/f, a.z/f);
}

/// <summary>
/// Assignment by division between a size and a float value
/// </summary>
/// <param name="a"> The size to be modified </param>
/// <param name="b"> The divisor float value </param>
/// <returns> A reference of the size modified </returns>
CICore::Size& CICore::operator /= (Size& a, const float f) {
    a.x /= f;
    a.y /= f;
    a.z /= f;

    return a;
}
/***************************************************************************************************************
************************************ endregion BASIC SIZE's BINARY OPERATIONS **********************************
****************************************************************************************************************/
